<template>
	<view class="container">
		<!-- #ifdef MP-WEIXIN -->
		<authorize></authorize>
		<!-- #endif -->
		<view class="o-plr">
			<view class="u-bb">
				<view class="l-fcc o-mt-b">
					<u-image width="160rpx" height="160rpx" shape="circle" :src="userInfo.avatarUrl"></u-image>
				</view>
				<view class="c-tc c-t8 o-ptb">{{userInfo.nickName}}</view>
			</view>
			<view v-if="tagList&&tagList.length>0" class="u-bb">
				<view class="o-ptb c-t65 c-tb">所在小区</view>
				<view class="l-fc l-fw">
					<view  v-for="(item,index) in tagList" :key="index" class="o-m-s o-mtn">
						<u-tag :text="item.label" mode="plain" closeable :show="item.show" @close="tagClick(index)"/>
					</view>
					<view class="o-m-s  o-mtn">
						<u-tag @click="addCell()"  text="添加" mode="light" />
					</view>
				</view>
			</view>
			<view v-if="phone" class="o-p c-t65 u-bb l-fjb">
				<view class="">手机号：{{phone}}</view>
				<view @click="$Function.LinkTo('/pages/mine/mobile/code')" class=""><text class="o-pr">更改手机号</text> <u-icon name="arrow-right" color="#8b8b8b" size="28"></u-icon></view>
			</view>
			<view @click="goComplaint()" class="o-p c-t65 u-bb l-fjb">
				<view class="">我的投诉</view>
				<u-icon name="arrow-right" color="#8b8b8b" size="28"></u-icon>
			</view>
			
			<view v-if="!userInfo.nickName || !phone">
				<u-button @click="login" style="margin-top: 200rpx;" type="primary">登陆</u-button>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: uni.getStorageSync('userInfo'),
				phone: null,
				// tagList: [],
				userId: uni.getStorageSync('userId'),
			}
		},
		computed:{
			showLg: vm => vm.$store.getters.showLg,
			showPhone: vm => vm.$store.getters.showPhone,
			tagList: vm => vm.$store.getters.myCell
		},
		onShow() {
			this.phone = uni.getStorageSync('phone')
		},
		onLoad() {
			if(this.userId) {
				this.get_tagList()
			}
		},
		methods: {
			//删除
			tagClick(index) {
				this.tagList[index].show = false
				this.tagList.filter((item) => item.show)
			},
			//添加
			addCell() {
				this.$Function.LinkTo('/pages/mine/add-cell')
			},
			// 去我的投诉
			goComplaint() {
				this.$Function.LinkTo('/pages/mine/complaint')
			},
			//登陆
			login() {
				this.$store.commit('get_show')
			},
			get_tagList() {
				this.$store.dispatch('get_myRegionList', {userId: this.userId})
			}
			
		}
	}
</script>

<style>
	
</style>
